import request from '@/utils/request'
//分页查询
export function pageRoleList(query){
    return request({
        url:"/role/pageRoleList",
        method:"get",
        params:query
    });
}
//新增
export function saveRole(data){
    return request({
        url:"/role/saveRole",
        method:"post",
        data
    })
}
//编辑
export function findByRoleId(roleId){
    return request({
        url:"/role/getById/"+roleId,
        method:"get"
    })
}
//修改
export function updateRole(data){
    return request({
        url:"/role/updateRole",
        method:"post",
        data
    })
}
//删除
export function delRoleByRoleId(roleId){
    return request({
        url:"/role/delRole/"+roleId,
        method:"get"
    })
}
//查询所有的角色
export function roleTreeselect(){
    return request({
        url:"/role/list",
        method:"get"
    })
}

// 为用户分配角色
export function toAdminAssignRole(data) {
    return request({
      url: '/role/assignRole',
      method: 'post',
      data
    })
}
//获取用户已分配的角色
export function getAdminRoleList(adminId){
    return request({
        url:"/role/getAdminRoleList/"+adminId,
        method:"get"
    });
}
//为角色分配权限
export function assignMenu(data){
    return request({
        url:"/role/assignMenu",
        method:"post",
        data
    })
}
  